
import 'life_circle_home_entity.dart';

lifeCircleHomeEntityFromJson(LifeCircleHomeEntity data, Map<String, dynamic> json) {
	if (json['current_page'] != null) {
		data.currentPage = json['current_page'] is String
				? int.tryParse(json['current_page'])
				: json['current_page'].toInt();
	}
	if (json['data'] != null) {
		data.data = (json['data'] as List).map((v) => LifeCircleHomeData().fromJson(v)).toList();
	}
	if (json['first_page_url'] != null) {
		data.firstPageUrl = json['first_page_url'].toString();
	}
	if (json['from'] != null) {
		data.from = json['from'] is String
				? int.tryParse(json['from'])
				: json['from'].toInt();
	}
	if (json['next_page_url'] != null) {
		data.nextPageUrl = json['next_page_url'];
	}
	if (json['path'] != null) {
		data.path = json['path'].toString();
	}
	if (json['per_page'] != null) {
		data.perPage = json['per_page'] is String
				? int.tryParse(json['per_page'])
				: json['per_page'].toInt();
	}
	if (json['prev_page_url'] != null) {
		data.prevPageUrl = json['prev_page_url'];
	}
	if (json['to'] != null) {
		data.to = json['to'] is String
				? int.tryParse(json['to'])
				: json['to'].toInt();
	}
	if (json['max_page'] != null) {
		data.maxPage = json['max_page'] is String
				? int.tryParse(json['max_page'])
				: json['max_page'].toInt();
	}
	return data;
}

Map<String, dynamic> lifeCircleHomeEntityToJson(LifeCircleHomeEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['current_page'] = entity.currentPage;
	data['data'] =  entity.data?.map((v) => v.toJson())?.toList();
	data['first_page_url'] = entity.firstPageUrl;
	data['from'] = entity.from;
	data['next_page_url'] = entity.nextPageUrl;
	data['path'] = entity.path;
	data['per_page'] = entity.perPage;
	data['prev_page_url'] = entity.prevPageUrl;
	data['to'] = entity.to;
	data['max_page'] = entity.maxPage;
	return data;
}

lifeCircleHomeDataFromJson(LifeCircleHomeData data, Map<String, dynamic> json) {
	if (json['_id'] != null) {
		data.sId = json['_id'].toString();
	}
	if (json['title'] != null) {
		data.title = json['title'].toString();
	}
	if (json['type'] != null) {
		data.type = json['type'].toString();
	}
	if (json['content'] != null) {
		data.content = json['content'].toString();
	}
	if (json['img_video'] != null) {
		data.imgVideo = (json['img_video'] as List).map((v) => LifeCircleHomeDataImgVideo().fromJson(v)).toList();
	}
	if (json['account_id'] != null) {
		data.accountId = json['account_id'].toString();
	}
	if (json['fabulous_count'] != null) {
		data.fabulousCount = json['fabulous_count'] is String
				? int.tryParse(json['fabulous_count'])
				: json['fabulous_count'].toInt();
	}
	if (json['views'] != null) {
		data.views = json['views'] is String
				? int.tryParse(json['views'])
				: json['views'].toInt();
	}
	if (json['users'] != null) {
		data.users = LifeCircleHomeDataUsers().fromJson(json['users']);
	}
	return data;
}

Map<String, dynamic> lifeCircleHomeDataToJson(LifeCircleHomeData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['_id'] = entity.sId;
	data['title'] = entity.title;
	data['type'] = entity.type;
	data['content'] = entity.content;
	data['img_video'] =  entity.imgVideo.map((v) => v.toJson()).toList();
	data['account_id'] = entity.accountId;
	data['fabulous_count'] = entity.fabulousCount;
	data['views'] = entity.views;
	data['users'] = entity.users.toJson();
	return data;
}

lifeCircleHomeDataImgVideoFromJson(LifeCircleHomeDataImgVideo data, Map<String, dynamic> json) {
	if (json['status'] != null) {
		data.status = json['status'].toString();
	}
	if (json['width'] != null) {
		data.width = json['width'] is String
				? double.tryParse(json['width'])
				: json['width'].toDouble();
	}
	if (json['height'] != null) {
		data.height = json['height'] is String
				? double.tryParse(json['height'])
				: json['height'].toDouble();
	}
	if (json['url'] != null) {
		data.url = json['url'].toString();
	}
	if (json['type'] != null) {
		data.type = json['type'].toString();
	}
	if (json['path'] != null) {
		data.path = json['path'].toString();
	}
	if (json['thumbPath'] != null) {
		data.thumbPath = json['thumbPath'].toString();
	}
	if (json['coverPic'] != null) {
		data.coverPic = json['coverPic'].toString();
	}
	if (json['endFrameUrl'] != null) {
		data.endFrameUrl = json['endFrameUrl'].toString();
	}
	if (json['completeUrl'] != null) {
		data.completeUrl = json['completeUrl'].toString();
	}
	if (json['thumbnail'] != null) {
		data.thumbnail = json['thumbnail'].toString();
	}
	if(json['completeStandUrl'] != null){
		data.completeStandUrl = json['completeStandUrl'].toString();
	}
	return data;
}

Map<String, dynamic> lifeCircleHomeDataImgVideoToJson(LifeCircleHomeDataImgVideo entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['status'] = entity.status;
	data['width'] = entity.width;
	data['height'] = entity.height;
	data['url'] = entity.url;
	data['type'] = entity.type;
	data['path'] = entity.path;
	data['thumbPath'] = entity.thumbPath;
	data['coverPic'] = entity.coverPic;
	data['endFrameUrl'] = entity.endFrameUrl;
	data['completeUrl'] = entity.completeUrl;
	data['thumbnail'] = entity.thumbnail;
	return data;
}

lifeCircleHomeDataUsersFromJson(LifeCircleHomeDataUsers data, Map<String, dynamic> json) {
	if (json['_id'] != null) {
		data.sId = json['_id'].toString();
	}
	if (json['nickname'] != null) {
		data.nickname = json['nickname'].toString();
	}
	if (json['avatar'] != null) {
		data.avatar = json['avatar'].toString();
	}
	return data;
}

Map<String, dynamic> lifeCircleHomeDataUsersToJson(LifeCircleHomeDataUsers entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['_id'] = entity.sId;
	data['nickname'] = entity.nickname;
	data['avatar'] = entity.avatar;
	return data;
}